/*
 * Copyright 2012 Clement Sannicolo <clement.sannicolo@gmail.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Ext.define('Nutrient.model.Food',
{
	extend: 'Ext.data.Model',

	fields: [
		{name: 'id', type: 'string'},
		{name: 'name', type: 'string'},
		{name: 'energy', type: 'float'},
		{name: 'protein', type: 'float'},
		{name: 'carbohydrates', type: 'float'},
		{name: 'starch', type: 'float'},
		{name: 'sugar', type: 'float'},
		{name: 'fat', type: 'float'},
		{name: 'fattyAcidsSaturated', type: 'float'},
		{name: 'fattyAcidsMonounsaturated', type: 'float'},
		{name: 'fattyAcidsPolyunsaturated', type: 'float'},		
		{name: 'water', type: 'float'},
		{name: 'alcohol', type: 'float'},
		{name: 'fiber', type: 'float'},
		{name: 'calcium', type: 'float'},
		{name: 'copper', type: 'float'},
		{name: 'iodine', type: 'float'},
		{name: 'iron', type: 'float'},
		{name: 'magnesium', type: 'float'},
		{name: 'manganese', type: 'float'},
		{name: 'phosphorus', type: 'float'},
		{name: 'potassium', type: 'float'},
		{name: 'selenium', type: 'float'},
		{name: 'sodium', type: 'float'},
		{name: 'zinc', type: 'float'},
		{name: 'vitaminA', type: 'float'},
		{name: 'vitaminB1', type: 'float'},
		{name: 'vitaminB2', type: 'float'},
		{name: 'vitaminB3', type: 'float'},
		{name: 'vitaminB5', type: 'float'},
		{name: 'vitaminB6', type: 'float'},
		{name: 'vitaminB9', type: 'float'},
		{name: 'vitaminB12', type: 'float'},
		{name: 'vitaminC', type: 'float'},
		{name: 'vitaminD', type: 'float'},
		{name: 'vitaminE', type: 'float'}
	],

	proxy: {
		type: 'rest',
		url: '/nutrient/food',
		format: 'json',
		reader: {
			type: 'json',
			root: 'rows'
		}
	}
});